home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5141 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: dziuxsolim.rutgers.edu!usenet
  2. From: Jordan Charney <jordanc@eden.rutgers.edu>
  3. Newsgroups: comp.lang.c
  4. Subject: Linked List Problem from a Beginner
  5. Date: Mon, 12 Feb 1996 14:56:34 -0500
  6. Organization: Rutgers University
  7. Message-ID: <311F9B72.12E4@eden.rutgers.edu>
  8. NNTP-Posting-Host: calloway-asy-13.rutgers.edu
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-poster: jordanc
  13. X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
  14.  
  15. I am trying to write a program that involves linked lists. It is supposed to be able to initialize, 
  16. rename, destroy, add to the end, insert, move through the list, delete and display. I am having some 
  17. trouble creating the correct code for it. 
  18.     The list has the following structure:
  19. typedef struct _listnode
  20. { void *data;
  21.   struct _listnode *next;
  22. } *listnode;
  23.  
  24. typedef struct _list
  25. {listnode head, tail current;
  26.   int length;
  27.   void *label;
  28. } *list
  29.  
  30.  
  31.     I am having trouble adding a node to the end of the list because I can't figure out how to move 
  32. the tail pointer and still keep that value in the list without losing the pointer to it.    
  33.     I also can't quite get the insert and the delete because i'm not sure how to write the code to 
  34. change what the previous entry is pointing to.
  35.     Any help is greatly appreciated
  36. -- 
  37.  
  38.                         -Jordan
  39. jordanc@eden.rutgers.edu
  40. http://www.eden.rutgers.edu/~jordanc
  41. **********************************************************************************************
  42.